home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / c_news / 05 / listings / f_baud.c < prev    next >
C/C++ Source or Header  |  1988-03-03  |  1KB  |  56 lines

  1. /************************************************************************/
  2. /*                                                                      */
  3. /*                                 F_BAUD.C                                */
  4. /*                          Level 1 FOSSIL function                        */
  5. /*                                                                          */
  6. /************************************************************************/
  7. /*                                                                          */
  8. /*                          FOSSIL Library Routine                        */
  9. /*                                                                        */
  10. /************************************************************************/
  11. /*              REVISION 5 FOSSIL INTERFACE SPECIFICATIONS              */
  12. /************************************************************************/
  13.  
  14. #include    "fossil.h"
  15.  
  16.  int
  17. f_baud(port,rate)
  18.  int            port;
  19.  unsigned int    rate;
  20. {
  21.     int        c;
  22.  
  23.     switch (rate) {
  24.         case (300):
  25.             c = 0x40;
  26.             break;
  27.         case (600):
  28.             c = 0x60;
  29.             break;
  30.         case (1200):
  31.             c = 0x80;
  32.             break;
  33.         case (2400):
  34.             c = 0xa0;
  35.             break;
  36.         case (4800):
  37.             c = 0xc0;
  38.             break;
  39.         case (9600):
  40.             c = 0xe0;
  41.             break;
  42.         case (19200):
  43.             c = 0x00;
  44.             break;
  45.         case (38400):
  46.             c = 0x20;
  47.             break;
  48.         default:
  49.             return(1);
  50.     }
  51.  
  52.     c |= 3;
  53.     return(f_setbaud(port,c));
  54. }
  55.  
  56.